#ifndef _DRIVER_HLW8032_H_
#define _DRIVER_HLW8032_H_

#define  POWER_CON_TIMING       1*60*60*1000  //1h
#define  D_CURRENT            (1.0*1.0102)
#define  D_VOLTAGE            (1.88*1.0076)
#define	 D_POWER				(1.0*D_CURRENT*D_VOLTAGE*0.9868)

#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>

void receive_uart_handle(uint8_t *p_data,int length);
void power_energy_proc(void);
void powerConTimingReport(void);
void power_energy_print(void);
int DealUartInf(unsigned char *inDataBuffer,int recvlen);
//=========================================================
typedef struct RuningInf_s{
	unsigned long  voltage;//当前电压值，单位为0.1V
	unsigned short  electricity;//当前电流值,单位为0.01A
	unsigned long   power;//当前功率,单位为0.1W
	
	unsigned long   energy;//当前消耗电能值对应的脉冲个数
	unsigned short  energyCurrent;//电能脉冲当前统计值
	unsigned short  energyLast;//电能脉冲上次统计值
	unsigned char   energyFlowFlag;//电能脉冲溢出标致
	
	unsigned long   energyUnit;//0.001度点对应的脉冲个数 
	
	unsigned long   power_energy;//度数 （消耗的电能单位0.001度）

    unsigned long   power_energy_sum;
}RuningInf_t;

extern RuningInf_t runingInf;

#endif

